package com.fupeng.tecent;

/**
 * Created by lecky on 2016/9/11 0011.
 */
public class Last {
    public static void main(String[] args) {
        System.out.println(solution(500));
    }

    public static int solution(int aim){
        int result=0;
        int half = aim>>1;
        for(int i=1;i<=half;i++){
            if(isZhiShu(i)&&isZhiShu(aim-i))
                result++;
        }
        return result;
    }

    /**
     * 判断aim是否为质数
     * 质数只能被自己和1整除
     * @param aim
     * @return
     */
    public static boolean isZhiShu(int aim){
        for(int i=2;i<aim;i++){
            if(aim%i==0)
                return false;
        }
        return true;
    }

}
